var ws,uid,c_id,t_id,r_id,spage,answer_id='';
document.addEventListener('plusready',function(){
	ws = plus.webview.currentWebview();
	uid = plus.storage.getItem('id');
	t_id = ws.t_id;
	c_id = ws.c_id;
	r_id = ws.r_id;
	spage = ws.spage; 
	console.log(t_id+'--'+c_id+'--'+r_id+'--'+spage);  
	if (r_id){
		answer_id = "&answer_id="+r_id;
	}
//	console.log(answer_id);  
//	console.log(circle+ "/index.php?act=theme&op=save_reply&c_id="+c_id+"&t_id="+t_id+"&u_id="+uid+"&type=mobile"+answer_id);
	$(".send").on('click',function(){
		if (!$("textarea").val()){
			mui.toast("请输入回复");return;
		}
		$.ajax({
			url:circle+ "/index.php?act=theme&op=save_reply&c_id="+c_id+"&t_id="+t_id+"&u_id="+uid+"&type=mobile"+answer_id,
			method:"POST",
			data:{
				form_submit:'ok',replycontent:$("textarea").val()
			},
			success:function(data){
//				console.log(JSON.stringify(data));return;
				//这里要返回页面并刷新详情页面
				mui.toast("发布成功"); 
				if(spage == 'view/Friends_circle.html'){
					plus.webview.getWebviewById(spage).reload();
					setTimeout(function(){
						ws.close();
					},500)
				}else{
					plus.webview.getWebviewById('view/Friends_circle.html').reload();                         
					setTimeout(function(){
						plus.webview.getWebviewById(spage).reload();
						setTimeout(function(){
							ws.close();
						},500)
					},500)
				}
			}
			
		})
	})
})